Clover coverage report - Enterprise Web Services - 1.0
Coverage timestamp: Mon May 30 2005 17:10:32 CEST
file stats: LOC: 106   Methods: 3
NCLOC: 66   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
EJBDDWriter.java 50% 97.7% 100% 90.9%
coverage coverage
 1   
 /*
 2   
  * Copyright 2001-2004 The Apache Software Foundation.
 3   
  * 
 4   
  * Licensed under the Apache License, Version 2.0 (the "License");
 5   
  * you may not use this file except in compliance with the License.
 6   
  * You may obtain a copy of the License at
 7   
  * 
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  * 
 10   
  * Unless required by applicable law or agreed to in writing, software
 11   
  * distributed under the License is distributed on an "AS IS" BASIS,
 12   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  * See the License for the specific language governing permissions and
 14   
  * limitations under the License.
 15   
  */
 16   
 
 17   
 package org.apache.geronimo.ews.ws4j2ee.toWs.ejb;
 18   
 
 19   
 /*
 20   
 import javax.xml.bind.JAXBContext;
 21   
 import javax.xml.bind.JAXBException;
 22   
 import javax.xml.bind.Marshaller;
 23   
 import javax.xml.bind.PropertyException; */
 24   
 
 25   
 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
 26   
 import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
 27   
 import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
 28   
 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
 29   
 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
 30   
 
 31   
 /**
 32   
  * We plan to use the JAXB to genarate and parse the
 33   
  * ejb-jar.xml file. This code is here just to get a simple
 34   
  * DD created
 35   
  *
 36   
  * @author Srinath Perera(hemapani@opensource.lk)
 37   
  */
 38   
 public class EJBDDWriter extends AbstractWriter {
 39   
     protected EJBContext ejbcontext;
 40   
 
 41   
     /**
 42   
      * @param j2eewscontext
 43   
      * @throws GenerationFault
 44   
      */
 45  8
     public EJBDDWriter(J2EEWebServiceContext j2eewscontext, EJBContext ejbcontext)
 46   
             throws GenerationFault {
 47  8
         super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath() + "/META-INF/ejb-jar.xml");
 48  8
         this.ejbcontext = ejbcontext;
 49   
     }
 50   
 
 51  8
     public void writeCode() throws GenerationFault {
 52  8
         if (out != null)
 53  8
             writeSessionDD();
 54   
     }
 55   
 
 56  8
     public void writeSessionDD() throws GenerationFault {
 57  8
         String ejbname = j2eewscontext.getWSCFContext().getWscfport().getServiceImplBean().getEjblink();
 58  8
         if (ejbname == null || ejbname.equals("")) {
 59  0
             throw new GenerationFault("Error reading ejbname from webservices.xml.");
 60   
         }
 61  8
         String version = GenerationConstants.J2EE_VERSION_1_4;
 62  8
         out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
 63  8
         out.write("<ejb-jar xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n");
 64  8
         out.write("         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
 65  8
         out.write("         xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n");
 66  8
         out.write("         http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd\"\n");
 67  8
         out.write("         version=\"2.1\">\n");
 68   
 
 69  8
         out.write("\t<enterprise-beans>\n");
 70  8
         out.write("\t\t<session>\n");
 71  8
         out.write("\t\t\t<display-name>" + j2eewscontext.getWSCFContext().getDisplayName() + "</display-name>\n");
 72  8
         out.write("\t\t\t<ejb-name>" + ejbname + "</ejb-name>\n");
 73  8
         String implStyle = j2eewscontext.getMiscInfo().getImplStyle();
 74  8
         if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
 75   
                 || GenerationConstants.USE_REMOTE.equals(implStyle)
 76   
                 || GenerationConstants.USE_INTERNALS.equals(implStyle)) {
 77  8
             out.write("\t\t\t<home>" + ejbcontext.getEjbhomeInterface() + "</home>\n");
 78  8
             out.write("\t\t\t<remote>" + ejbcontext.getEjbRemoteInterface() + "</remote>\n");
 79   
         }
 80  8
         if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
 81   
                 || GenerationConstants.USE_LOCAL.equals(implStyle)) {
 82  8
             out.write("\t\t\t<local-home>" + ejbcontext.getEjbLocalHomeInterfce() + "</local-home>\n");
 83  8
             out.write("\t\t\t<local>" + ejbcontext.getEjbLocalInterface() + "</local>\n");
 84   
         }
 85  8
         out.write("\t\t\t<ejb-class>" + ejbcontext.getImplBean() + "</ejb-class>\n");
 86  8
         out.write("\t\t\t<session-type>Stateless</session-type>\n");
 87  8
         out.write("\t\t\t<transaction-type>Bean</transaction-type>\n");
 88  8
         out.write("\t\t\t<security-identity>\n");
 89  8
         out.write("\t\t\t\t<description></description>\n");
 90  8
         out.write("\t\t\t\t<use-caller-identity></use-caller-identity>\n");
 91  8
         out.write("\t\t\t</security-identity>\n");
 92  8
         out.write("\t\t</session>\n");
 93  8
         out.write("\t</enterprise-beans>\n");
 94  8
         out.write("\t<assembly-descriptor>\n");
 95  8
         out.write("\t    <method-permission>\n");
 96  8
         out.write("\t        <unchecked/>\n");
 97  8
         out.write("\t        <method>\n");
 98  8
         out.write("\t             <ejb-name>" + ejbname + "</ejb-name>\n");
 99  8
         out.write("\t             <method-name>*</method-name>\n");
 100  8
         out.write("\t        </method>\n");
 101  8
         out.write("\t     </method-permission>\n");
 102  8
         out.write("\t</assembly-descriptor>\n");
 103  8
         out.write("</ejb-jar>\n");
 104   
     }
 105   
 }
 106